package com.czxy.service;

import com.czxy.dao.BaseDictMapper;
import com.czxy.domain.BaseDict;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class BaseDictServiceImpl implements BaseDictService{

    @Resource
    private BaseDictMapper baseDictMapper;

    @Override
    public List<BaseDict> findAllCustSource() {
        // 客户信息来源
        Example example = new Example(BaseDict.class);
        Example.Criteria ct = example.createCriteria();
        ct.andEqualTo("dictTypeCode",BaseDict.CUST_SOURCE_TYPE_CODE);

        List<BaseDict> baseDicts = baseDictMapper.selectByExample(example);

        return baseDicts;
    }

    @Override
    public List<BaseDict> findAllCustLevel() {
        // 客户级别
        Example example = new Example(BaseDict.class);
        Example.Criteria ct = example.createCriteria();
        ct.andEqualTo("dictTypeCode", BaseDict.CUST_LEVEL_TYPE_CODE);

        List<BaseDict> baseDicts = baseDictMapper.selectByExample(example);

        return baseDicts;
    }
}
